<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/includes.jsp" %>
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>分类管理|OneThink管理平台</title>
    <link href="${ctx}/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/module.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/style.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/default_color.css" media="all">
    <!--[if lt IE 9]>
    <script type="text/javascript" src="${ctx}/static/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="${ctx}/static/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="${ctx}/admin/js/jquery.mousewheel.js"></script>
    <!--<![endif]-->

</head>
<body>
<!-- 头部 -->
<div class="header">
    <!-- Logo -->
    <span class="logo"></span>
    <!-- /Logo -->

    <!-- 主导航 -->
    <ul class="main-nav">
        <li class=""><a href="/ot1/admin.php?s=/Index/index.html">首页</a></li>
        <li class=""><a href="/ot1/admin.php?s=/Article/index.html">内容</a></li>
        <li class=""><a href="/ot1/admin.php?s=/User/index.html">用户</a></li>
        <li class="current"><a href="/ot1/admin.php?s=/Config/group.html">系统</a></li>
        <li class=""><a href="/ot1/admin.php?s=/Addons/index.html">扩展</a></li>
    </ul>
    <!-- /主导航 -->

    <!-- 用户栏 -->
    <div class="user-bar">
        <a href="javascript:;" class="user-entrance"><i class="icon-user"></i></a>
        <ul class="nav-list user-menu hidden">
            <li class="manager">你好，<em title="Administrator">Administrator</em></li>
            <li><a href="/ot1/admin.php?s=/User/updatePassword.html">修改密码</a></li>
            <li><a href="/ot1/admin.php?s=/User/updateNickname.html">修改昵称</a></li>
            <li><a href="/ot1/admin.php?s=/Public/logout.html">退出</a></li>
        </ul>
    </div>
</div>
<!-- /头部 -->

<!-- 边栏 -->
<div class="sidebar">
    <!-- 子导航 -->

    <div id="subnav" class="subnav">
        <!-- 子导航 -->
        <h3><i class="icon icon-unfold"></i>系统设置</h3>
        <ul class="side-sub-menu">
            <li>
                <a class="item" href="/ot1/admin.php?s=/Config/group.html">网站设置</a>
            </li>
            <li>
                <a class="item" href="${ctx}/admin/partstype/add.shtml">分类管理</a>
            </li>
            <li>
                <a class="item" href="/ot1/admin.php?s=/Model/index.html">模型管理</a>
            </li>
            <li>
                <a class="item" href="/ot1/admin.php?s=/Config/index.html">配置管理</a>
            </li>
            <li>
                <a class="item" href="/ot1/admin.php?s=/Menu/index.html">菜单管理</a>
            </li>
            <li>
                <a class="item" href="/ot1/admin.php?s=/Channel/index.html">导航管理</a>
            </li>
        </ul>                    <!-- /子导航 --><!-- 子导航 -->
        <h3><i class="icon icon-unfold"></i>数据备份</h3>
        <ul class="side-sub-menu">
            <li>
                <a class="item" href="/ot1/admin.php?s=/Database/index/type/export.html">备份数据库</a>
            </li>
            <li>
                <a class="item" href="/ot1/admin.php?s=/Database/index/type/import.html">还原数据库</a>
            </li>
        </ul>                    <!-- /子导航 -->            </div>

    <!-- /子导航 -->
</div>
<!-- /边栏 -->

<!-- 内容区 -->
<div id="main-content">
    <div id="top-alert" class="fixed alert alert-error" style="display: none;">
        <button class="close fixed" style="margin-top: 4px;">&times;</button>
        <div class="alert-content">这是内容</div>
    </div>
    <div id="main" class="main">
        <!-- nav -->
        <!-- nav -->
        <div class="main-title">
            <h2>分类管理</h2>
        </div>
        <!-- 表格列表 -->
        <div class="tb-unit posr">
            <div class="tb-unit-bar">
                <a class="btn" href="${ctx}/admin/partstype/add.shtml">新 增</a>
            </div>
            <div class="category">
                <div class="hd cf">
                    <div class="fold">折叠</div>
                    <div class="order">排序</div>
                    <div class="order">代码</div>
                    <div class="enname">名称(英文)</div>
                    <div class="name">名称</div>
                </div>
                <c:import url="/admin/partstype/tree.shtml"/>
            </div>
        </div>
        <!-- /表格列表 -->

    </div>
    <div class="cont-ft">
        <div class="copyright">
            <div class="fl">感谢使用管理平台</div>
            <div class="fr">V1.0</div>
        </div>
    </div>
</div>
<!-- /内容区 -->

<script type="text/javascript" src="${ctx}/static/think.js"></script>
<script type="text/javascript" src="${ctx}/admin/js/common.js"></script>
<script type="text/javascript">
    +function () {
        var $window = $(window), $subnav = $("#subnav"), url;
        $window.resize(function () {
            $("#main").css("min-height", $window.height() - 130);
        }).resize();

        /* 左边菜单高亮 */
        url = window.location.pathname + window.location.search;
        url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
        $subnav.find("a[href='" + url + "']").parent().addClass("current");

        /* 左边菜单显示收起 */
        $("#subnav").on("click", "h3", function () {
            var $this = $(this);
            $this.find(".icon").toggleClass("icon-fold");
            $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").prev("h3").find("i").addClass("icon-fold").end().end().hide();
        });

        $("#subnav h3 a").click(function (e) {
            e.stopPropagation()
        });

        /* 头部管理员菜单 */
        $(".user-bar").mouseenter(function () {
            var userMenu = $(this).children(".user-menu ");
            userMenu.removeClass("hidden");
            clearTimeout(userMenu.data("timeout"));
        }).mouseleave(function () {
            var userMenu = $(this).children(".user-menu");
            userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
            userMenu.data("timeout", setTimeout(function () {
                userMenu.addClass("hidden")
            }, 100));
        });

        /* 表单获取焦点变色 */
        $("form").on("focus", "input", function () {
            $(this).addClass('focus');
        }).on("blur", "input", function () {
            $(this).removeClass('focus');
        });
        $("form").on("focus", "textarea", function () {
            $(this).closest('label').addClass('focus');
        }).on("blur", "textarea", function () {
            $(this).closest('label').removeClass('focus');
        });

        // 导航栏超出窗口高度后的模拟滚动条
        var sHeight = $(".sidebar").height();
        var subHeight = $(".subnav").height();
        var diff = subHeight - sHeight; //250
        var sub = $(".subnav");
        if (diff > 0) {
            $(window).mousewheel(function (event, delta) {
                if (delta > 0) {
                    if (parseInt(sub.css('marginTop')) > -10) {
                        sub.css('marginTop', '0px');
                    } else {
                        sub.css('marginTop', '+=' + 10);
                    }
                } else {
                    if (parseInt(sub.css('marginTop')) < '-' + (diff - 10)) {
                        sub.css('marginTop', '-' + (diff - 10));
                    } else {
                        sub.css('marginTop', '-=' + 10);
                    }
                }
            });
        }
    }();
</script>

<script type="text/javascript">
    (function ($) {
        /* 分类展开收起 */
        $(".category dd").prev().find(".fold i").addClass("icon-unfold")
                .click(function () {
                    var self = $(this);
                    if (self.hasClass("icon-unfold")) {
                        self.closest("dt").next().slideUp("fast", function () {
                            self.removeClass("icon-unfold").addClass("icon-fold");
                        });
                    } else {
                        self.closest("dt").next().slideDown("fast", function () {
                            self.removeClass("icon-fold").addClass("icon-unfold");
                        });
                    }
                });

        /* 三级分类删除新增按钮 */
        $(".category dd dd .add-sub").remove();

        /* 实时更新分类信息 */
        $(".category")
                .on("submit", "form", function () {
                    var self = $(this);
                    $.post(
                            self.attr("action"),
                            self.serialize(),
                            function (data) {
                                /* 提示信息 */
                                var name = data.status ? "success" : "error", msg;
                                msg = self.find(".msg").addClass(name).text(data.info)
                                        .css("display", "inline-block");
                                setTimeout(function () {
                                    msg.fadeOut(function () {
                                        msg.text("").removeClass(name);
                                    });
                                }, 1000);
                            },
                            "json"
                    );
                    return false;
                })
                .on("focus", "input", function () {
                    $(this).data('param', $(this).closest("form").serialize());

                })
                .on("blur", "input", function () {
                    if ($(this).data('param') != $(this).closest("form").serialize()) {
                        $(this).closest("form").submit();
                    }
                });
    })(jQuery);
</script>

</body>
</html>